package com.example.demo99.Service.Impl;

import com.example.demo99.Entity.VO.ProductSalesStatsVO;
import com.example.demo99.Entity.VO.SalesTrendVO;
import com.example.demo99.Mapper.OrderProductMapper;
import com.example.demo99.Service.SalesStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SalesStatisticsServiceImpl implements SalesStatisticsService {

    @Autowired
    private OrderProductMapper orderProductMapper;
    // 获取某段时间内销售最多的产品
    @Override
    public ProductSalesStatsVO getTopSellingProduct(String startDate, String endDate) {
        return orderProductMapper.getTopSellingProduct(startDate, endDate);
    }
    // 获取每个产品总销售数量与金额
    @Override
    public List<ProductSalesStatsVO> getProductSalesStats(String startDate, String endDate) {
        return orderProductMapper.getProductSalesStats(startDate, endDate);
    }
    // 获取销售趋势（按月）
    @Override
    public List<SalesTrendVO> getSalesTrendByMonth(String startDate, String endDate) {
        return orderProductMapper.getSalesTrendByMonth(startDate, endDate);
    }
}
